/**
 *  Copyright (C) 2008-2013  Telosys project org. ( http://www.telosys.org/ )
 *
 *  Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, Version 3.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *          http://www.gnu.org/licenses/lgpl.html
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.telosys.persistence.connection;

import java.sql.Connection;


/**
 * Interface that must be implemented by each "connection provider"
 * 
 * @author Laurent GUERIN
 *  
 */
public interface ConnectionProvider 
{
    public final static int NO_PROVIDER = 0 ;
    public final static int SINGLE      = 1 ;
    public final static int POOL        = 2 ;
    public final static int DATASOURCE  = 3 ;
    public final static int CUSTOMCLASS = 4 ; // v 1.0.1
    
//    /**
//     * Returns the name of the ConnectionProvider
//     * @return
//     */
//    public String getName() ;
    
    /**
     * Returns a standard JDBC Connection 
     * @return
     * @throws Exception
     */
    public Connection getConnection() throws Exception;
    
    
    /**
     * Returns the type of ConnectionProvider : SINGLE, POOL, DATASOURCE, CUSTOMCLASS <br>
     * @return
     * @since 1.0.0
     */
    public int getType() ;
    
    /**
     * Returns the type name of ConnectionProvider 
     * @return
     * @since 2.0
     */
    public String getTypeName();
    
//    /**
//     * Returns the initial pool size for a pool, 0 for a single connection, -1 for a DataSource
//     * @return
//     * @since 2.0
//     * @return
//     */
//    public int getInitialPoolSize();
//
//    /**
//     * Returns the current pool size for a pool, 0 for a single connection, -1 for a DataSource
//     * @return
//     * @since 2.0
//     */
//    public int getCurrentPoolSize() ;
    
    /**
     * Returns the connection pool status 
     * @return
     * @since 2.0
     */
    public PoolStatus getPoolStatus() ;

}